
<%@ page import="baratopradedeu.Cupom" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'cupom.label', default: 'Cupom')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
				div class="message">${flash.message}</div>
            </g:if>
			<div class="dialog">
				<g:form action="listCupomCliente" method="post">
				<fieldset>
					<legend>Filtros</legend>
					<table>
						<tbody>
							<tr class="prop">
									<td valign="top" class="name">
										<label for="dataValidade"><g:message code="cupom.dataValidade.label" default="Data Validade" /></label>
									</td>
									<td valign="top" class="value ${hasErrors(bean: cupomInstance, field: 'dataValidade', 'errors')}">										
										 <g:textField name="dataValidade" value="${cupomInstance?.dataValidade}" />
										 
									</td>
								</tr>
							<tr class="prop">
									<td valign="top" class="name">
										<label for="statusCupom"><g:message code="cupom.statusCupom.label" default="Status Cupom" /></label>
									</td>
									<td valign="top" class="value ${hasErrors(bean: cupomInstance, field: 'statusCupom', 'errors')}">										
										<g:select name="statusCupom" from="${['Selecione', 'true', 'false']}">
										
										</g:select>
									</td>
								</tr>
						</tbody>
					</table>
					<div class="buttons">
						<span class="button">
							<g:submitButton name="listCupomCliente" class="save" value="Pesquisar" />
						</span>
					</div>
				</fieldset>
				</g:form>
			</div>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                        
                            <g:sortableColumn property="id" title="${message(code: 'cupom.id.label', default: 'Id')}" />
                        
                            <th><g:message code="cupom.cliente.label" default="Cliente" /></th>
                        
                            <g:sortableColumn property="dataCompra" title="${message(code: 'cupom.dataCompra.label', default: 'Data Compra')}" />
                        
                            <g:sortableColumn property="dataValidade" title="${message(code: 'cupom.dataValidade.label', default: 'Data Validade')}" />
                        
                            <th><g:message code="cupom.oferta.label" default="Oferta" /></th>
                        
                            <th><g:message code="cupom.pedido.label" default="Pedido" /></th>
							
							<th><g:message code="cupom.pedido.label" default="Status do Cupom" /></th>
                        
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${cupomInstanceList}" status="i" var="cupomInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                            <td><g:link action="show" id="${cupomInstance.id}">${fieldValue(bean: cupomInstance, field: "id")}</g:link></td>
                        
                            <td>${fieldValue(bean: cupomInstance, field: "cliente")}</td>
                        
                            <td><g:formatDate date="${cupomInstance.dataCompra}" format="dd/MM/yyyy" precision="day"/></td>							
                        
                            <td><g:formatDate date="${cupomInstance.dataValidade}" format="dd/MM/yyyy" precision="day" /></td>
                        
                            <td>${fieldValue(bean: cupomInstance, field: "oferta")}</td>
                        
                            <td>${fieldValue(bean: cupomInstance, field: "pedido")}</td>
							
							<td>${fieldValue(bean: cupomInstance, field: "statusCupom")}</td>                        
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${cupomInstanceTotal}" />
            </div>
        </div>
    </body>
</html>
